﻿using System;
using System.Windows;
using Socium.Presentation;

namespace Socium {
	class DialogFormViewService : IFormViewService {
		public void Show(IFormViewModel workspace) {
			var dialog = new DialogWindow { DataContext = workspace };

			Action close = dialog.Close;
			workspace.Canceled += close;
			workspace.Saved += close;

			dialog.ShowDialog();
		}

		public bool Confirm(string message) {
			var result = MessageBox.Show(message, "Socium", MessageBoxButton.YesNo);
			return result == MessageBoxResult.Yes;
		}
	}
}
